unit uEngines.local;

interface

uses uDebug.common;

type
  //================================ ENGINES
  TEngineItem = record
    EngineID   : integer;
    Name       : string;
    MaxKPH     : integer;
    Durability : integer;
  end;
  TEngineList = class( TObject )
  public
    Items : array of TEngineItem;
    Count : integer;

    constructor Create;
    destructor Destroy; override;

    procedure Add( nEngineID:integer;nName:string;nMaxKPH,nDurability:integer);
    procedure Clear;
  end;

implementation

  //================================ ENGINES
constructor TEngineList.Create;
begin
  inherited Create;

  Count := 0;
  SetLength( Items, Count );
end;
destructor TEngineList.Destroy;
begin
  Count := 0;
  SetLength( Items, Count );

  inherited Destroy;
end;
procedure TEngineList.Add( nEngineID:integer;nName:string;nMaxKPH:integer;nDurability:integer);
begin
  DevConsole.Msg(ES_DEBUG, 'Adding Engine '+nName);

  Inc( Count );
  SetLength(Items, Count);

  with Items[ Count-1 ] do
  begin
    EngineID   := nEngineID;
    Name       := nName;
    MaxKPH     := nMaxKPH;
    Durability := nDurability;
  end;
end;
procedure TEngineList.Clear;
begin
  Count := 0;
  SetLength( Items, Count );
end;

end.
